inspector: Show object title in hierarchy tab
authorMatthias Clasen <mclasen@redhat.com>
Sat, 22 Nov 2014 18:54:16 +0000 (13:54 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 23 Nov 2014 02:38:47 +0000 (21:38 -0500)
gtk/inspector/object-hierarchy.c
gtk/inspector/object-hierarchy.ui

index 27071b4acbde7ae1fdbd750dbe7a6bcd2322fb34..fd26981231cc7f4b676d3dc39dfe144671907b4a 100644 (file)
@@ -28,6 +28,7 @@
 #include "gtktreeselection.h"
 #include "gtktreestore.h"
 #include "gtktreeview.h"
+#include "gtklabel.h"
 
 
 enum
@@ -39,6 +40,7 @@ struct _GtkInspectorObjectHierarchyPrivate
 {
   GtkTreeStore *model;
   GtkTreeView *tree;
+  GtkWidget *object_title;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
@@ -58,6 +60,7 @@ gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *kla
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/object-hierarchy.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, object_title);
 }
 
 void
@@ -72,6 +75,7 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
   GHashTableIter hit;
   GType *ifaces;
   gint i;
+  const gchar *title;
 
   gtk_tree_store_clear (oh->priv->model);
 
@@ -80,7 +84,10 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
 
   interfaces = g_hash_table_new (g_str_hash, g_str_equal);
   type = ((GTypeInstance*)object)->g_class->g_type;
-  
+
+  title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
+  gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
+
   do
     {
       class_name = g_type_name (type);
index 2b25cf7b36c32f6dc671b5b23cdca59bbaee2c43..d8a99ccce68d0ed3360e598fce2f9942dedf7637 100644 (file)
@@ -6,7 +6,16 @@
     </columns>
   </object>
   <template class="GtkInspectorObjectHierarchy" parent="GtkBox">
-    <property name="orientation">horizontal</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkLabel" id="object_title">
+        <property name="visible">True</property>
+        <property name="halign">fill</property>
+        <property name="valign">center</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+      </object>
+    </child>
     <child>
       <object class="GtkScrolledWindow">
         <property name="visible">True</property>